home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / setfil_1 / fontmod.bas < prev    next >
BASIC Source File  |  1999-09-02  |  5KB  |  81 lines

  1. Attribute VB_Name = "Fontmod"
  2. Option Explicit
  3. Public Const Top = 1 'Const for Y axis
  4. Public Const Middle = 2 'Const for Y axis
  5. Public Const Bottom = 3 'Const for Y axis
  6. Public Sub Pause(HowLong As String) 'The pause, I found strings work better
  7. Dim TheBeginning
  8. TheBeginning = Timer
  9. Do While Timer < TheBeginning + HowLong
  10. DoEvents
  11. Loop
  12. End Sub
  13. Sub TxtRight(Txt As String, Delay As String, Increment As Integer, YPos As Integer, PicBox As PictureBox)
  14. Dim a As Integer, b As Integer
  15. PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
  16. a% = 0
  17. Do 'Start loop
  18. DoEvents
  19. PicBox.Cls 'Clear picture box
  20. If YPos = 1 Then 'Check to see where the user wants the text to show
  21. PicBox.CurrentY = 0 'Top
  22. ElseIf YPos = 2 Then 'Middle
  23. PicBox.CurrentY = PicBox.ScaleHeight / 2 - (PicBox.TextHeight(Txt) + PicBox.FontSize) / 2 - PicBox.FontSize 'Middle
  24. ElseIf YPos = 3 Then 'Bottom
  25. PicBox.CurrentY = PicBox.ScaleHeight - (PicBox.TextHeight(Txt) - PicBox.FontSize) 'Bottom
  26. End If
  27. a% = a% + Increment% 'Add in the increment so it will move
  28. PicBox.CurrentX = a% 'Set the X axis to what the increment has been changed to
  29. b% = PicBox.FontSize + PicBox.TextWidth(Txt$) + PicBox.CurrentX 'Check to see where the X axis is plus the font size and text width
  30. PicBox.Print Txt$ 'Show the text after everything has been set
  31. Pause Delay$ 'Pause so the text won't go so fast that you can't see it move, .00001 is a good pause time
  32. Loop Until b% >= PicBox.ScaleWidth 'Stop looping if the X axis has reached the end if the picture box
  33. End Sub
  34. Sub TxtLeft(Txt As String, Delay As String, Increment As Integer, YPos As Integer, PicBox As PictureBox)
  35. Dim a As Integer, b As Integer
  36. PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
  37. a% = PicBox.ScaleWidth - (PicBox.TextWidth(Txt) + PicBox.FontSize)
  38. Do 'Start loop
  39. DoEvents
  40. PicBox.Cls 'Clear picture box
  41. If YPos = 1 Then 'Check to see where the user wants the text to show
  42. PicBox.CurrentY = 0 'Top
  43. ElseIf YPos = 2 Then 'Middle
  44. PicBox.CurrentY = PicBox.ScaleHeight / 2 - (PicBox.TextHeight(Txt) + PicBox.FontSize) / 2 - PicBox.FontSize 'Middle
  45. ElseIf YPos = 3 Then 'Bottom
  46. PicBox.CurrentY = PicBox.ScaleHeight - (PicBox.TextHeight(Txt) - PicBox.FontSize) 'Bottom
  47. End If
  48. a% = a% + Increment% 'Add in the increment so it will move
  49. PicBox.CurrentX = a% 'Set the X axis to what the increment has been changed to
  50. b% = PicBox.CurrentX 'Check to see where the X axis is
  51. PicBox.Print Txt$ 'Show the text after everything has been set
  52. Pause Delay$ 'Pause so the text won't go so fast that you can't see it move, .00001 is a good pause time
  53. Loop Until b% <= 0 'Stop looping if the X axis is at the beginning of the picture box
  54. End Sub
  55. Sub Grow(Txt As String, MaxSize As Integer, MinSize As Integer, Delay As String, PicBox As PictureBox)
  56. PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
  57. PicBox.FontSize = MinSize 'Set the size of the font to the minium that the user specified
  58. Do 'Start do
  59. DoEvents
  60. Pause Delay$ 'Pause so the text won't go so fast that you can't see it move, .00001 is a good pause time
  61. PicBox.Cls 'Clear picture box
  62. PicBox.FontSize = PicBox.FontSize + 1 'Makes the font size grow, hence the sub name Grow
  63. PicBox.CurrentX = PicBox.ScaleWidth / 2 - PicBox.TextWidth(Txt) / 2 'Set the X axis to the middle
  64. PicBox.CurrentY = PicBox.ScaleHeight / 2 - (PicBox.TextHeight(Txt) + PicBox.FontSize) / 2 - PicBox.FontSize 'Set the Y axis to the middle
  65. PicBox.Print Txt$ 'Show the text after everything has been set
  66. Loop Until PicBox.FontSize >= MaxSize 'If the size of the font is at or above the maximum, then stop looping
  67. End Sub
  68. Sub Shrink(Txt As String, MaxSize As Integer, MinSize As Integer, Delay As String, PicBox As PictureBox)
  69. PicBox.Font = "Arial" 'Set the font to Arial, I know Arial is a good font, works well and normal sizes not like 8.25 and 9.7 and stuff like that
  70. PicBox.FontSize = MaxSize 'Set the size of the font to the maximum that the user specified
  71. Do 'Start do
  72. DoEvents
  73. Pause Delay$ 'Pause so the text won't go so fast that you can't see it move, .00001 is a good pause time
  74. PicBox.Cls 'Clear picture box
  75. PicBox.FontSize = PicBox.FontSize - 1 'Makes the font size shrink, hence the sub name Shrink
  76. PicBox.CurrentX = PicBox.ScaleWidth / 2 - PicBox.TextWidth(Txt) / 2 'Set the X axis to the middle
  77. PicBox.CurrentY = PicBox.ScaleHeight / 2 - (PicBox.TextHeight(Txt) + PicBox.FontSize) / 2 - PicBox.FontSize 'Set the Y axis to the middle
  78. PicBox.Print Txt$ 'Show the text after everything has been set
  79. Loop Until PicBox.FontSize <= MinSize 'IF the size of the font is at or below the minium, then stop looping
  80. End Sub
  81.